<?php
header('Access-Control-Allow-Origin:*');
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
//Route::any('login_entrance','admin/login/index');deviceLogin.html
// +----------------------------------------------------------------------
Route::get('pintuan/:token', 'api/config/pintuan');
//Route::get('addclass', 'api/config/addclass');
// 授权1
Route::group('oauth', function () {
    // 通过code换取token令牌
    Route::post('token', 'api/token/getToken');
    // 获取用户信息
    Route::post('userInfo/:token', 'api/oauth/getUserInfo');
    // 绑定手机号码
    Route::post('phone/:token', 'api/oauth/getPhone');
    // 刷新token
    Route::post('refresh/:token', 'api/token/refresh');
    //刷新apptoken
    Route::post('refreshAppToken/:refreshToken', 'api/token/refreshAppToken');

    Route::post('delUser/:token', 'api/oauth/delUser');
})->ext('html');

// 微信授权登录
Route::group('wxoauth', function () {
    // 获取用户信息
    Route::post('authorize', 'api/wxoauth/authorize');
})->ext('html');


// 手机号码注册登录
Route::group('phone', function () {
    // 获取验证码
    Route::post('code', 'getCode');

    // 注册
    Route::post('reg', 'reg');
    // 一键登录
    Route::post('keylogin', 'keyLogin');
    // 密码登录
    Route::post('plogin', 'phonePwdLogin');
    Route::post('phoneFingerprint', 'phoneFingerprint');

    // 验证码登录
    Route::post('clogin', 'phoneCodeLogin');
    // 忘记密码
    Route::post('fpwd', 'forgetPwd');
    // 微信授权
    Route::post('authorize', 'authorize');
    // 用户协议
    Route::get('agreement', 'agreement');

    Route::get('deviceReg', 'deviceReg');


    Route::get('deviceLogin', 'deviceLogin');

})->prefix('api/phone/')->ext('html');

//退出登录
Route::group('loginout', function () {
    // 退出登录
    Route::post('loginout/:token', 'api/loginout/index');
})->ext('html');



// 首页
Route::group('index', function () {
    // 搜索
    Route::get('search/:token', 'api/search/index');
    // 幻灯片列表
    Route::get('slides/:token', 'api/slides/index');

    Route::get('searchStatic', 'api/search/index?needToken=0');
    // 幻灯片列表
    Route::get('slidesStatic', 'api/slides/index?needToken=0');
})->ext('html');

// 客服
Route::group('customer', function () {
    // 客服列表
    Route::get('static', 'index?needToken=0');
    Route::get(':token', 'index');
})->prefix('api/customerService/')->ext('html')->pattern(['page' => '\d+', 'size' => '\d+']);

// 语种
Route::group('lang', function () {
    // 小语种列表
    Route::get('static', 'index?needToken=0');
    Route::get(':token', 'index');
    
})->prefix('api/lang/')->ext('html')->pattern(['page' => '\d+', 'size' => '\d+']);

// 语种班级
Route::group('class', function () {
    // 分享的班级介绍
    Route::get('introduceShare', 'api/langClass/read?needToken=0');
    Route::get('introduceStatic', 'api/langClass/read?needToken=0');
    // 班级介绍
    Route::get('introduce/:token', 'api/langClass/read');
    // 购买班级页面
    Route::get('info/:token', 'api/langClass/buyInfo');
    // 背单词或者句子 选择哪一节课的二级联动
    Route::get('select/:token', 'api/oauthOrderClass/select');
    // 我的课程
    Route::get('mine/:token', 'api/oauthOrderClass/index');
    // 购买班级--统一下单(小程序)
    Route::post('prepay/:token', 'api/langClass/prepay');
    // 购买班级--统一下单(小程序)
    Route::post('prepayApp/:token', 'api/langClass/prepayApp');

    
})->ext('html');

// 支付
Route::group('pay', function () {
    //微信支付回调
    Route::post('notify', 'notify');
    //微信支付回调
    Route::post('wxnotify', 'wxnotify');
    //支付宝支付回调
    Route::post('alinotify', 'alinotify');
    // 苹果内购验证
    Route::post('appleNotify', 'appleNotify');
})->prefix('api/pay/')->ext('html');

// 语种文件（视频、音频、学习资料等）
Route::group('file', function () {
    // 分享的获取课程下面的文件内容，通过班级id和课程类型，课件类型
    Route::get('listShare', 'api/langClassFile/read?needToken=0');

    Route::get('listStatic', 'api/langClassFile/read?needToken=0');

    Route::get('freeStatic', 'api/langClassFile/free?needToken=0');

    // 免费的视频列表
    Route::get('free/:token', 'api/langClassFile/free');
    // 获取课程下面的文件内容，通过班级id和课程类型，课件类型
    Route::get('list/:token', 'api/langClassFile/read');
    // 观看视频、音频、课件等
    Route::get('watch/:token', 'api/langClassFile/watch');
    // 观看转码视频、音频、课件等
    Route::get('transferWatch/:token', 'api/langClassFile/transferWatch');
    // 分享观看视频、音频、课件等
    Route::get('watchShare', 'api/langClassFile/watch?needToken=0');
    // 下载课件
    Route::post('download/:token', 'api/langClassFile/download');
})->ext('html')->pattern(['page' => '\d+', 'size' => '\d+']);

// 背单词或者句子
Route::group('recite', function () {
    // 背单词|句子
    Route::get('list/:token', 'api/langClassRecite/index');
    // 错题本 或者 收藏本
    Route::get('mine/:token', 'api/oauthRecite/index');
    // 错题本 或者 收藏本 批量添加记录
    Route::post('addBatch/:token', 'api/oauthRecite/addBatch');
    // 错题本 或者 收藏本详情
    Route::get('detail/:token', 'api/oauthRecite/read');
    // 移除 错题本 或者 收藏本 一条记录
    Route::delete('delete/:token', 'api/oauthRecite/delete');
    // 套题选择
    Route::get('type/:token', 'api/langClassRecite/type');
})->ext('html');

// 优惠券列表
Route::group('coupon', function () {
    // 未使用、已使用、已过期
    Route::get('list/:token', 'index');
})->prefix('api/coupon/')->ext('html')->pattern(['page' => '\d+', 'size' => '\d+']);

// 贴吧
Route::group('tie', function () {
    // 帖子板块分类
    Route::get('type/:token', 'api/tieBaType/index');
    // 帖子列表 或者 个人主页帖子列表（包括我的帖子）
    Route::get('list/:token', 'api/tieBa/index');
    // 帖子详情 或者 我的消息列表查看帖子详情 评论分页
    Route::get('detail/:token', 'api/tieBa/read');
    // 发表帖子
    Route::post('create/:token', 'api/tieBa/create');
    // 我的消息列表
    Route::get('message/:token', 'api/tieBaComment/index');
    // 上传文件
    Route::post('unReadMessage/:token', 'api/tieBaComment/unReadMessage');
    // 删除帖子
    Route::delete('delete/:token', 'api/tieBa/delete');
    // 评论或者回复
    Route::post('comment/:token', 'api/tieBaComment/create');
    // 删除评论或者回复
    Route::delete('delComment/:token', 'api/tieBaComment/delete');
    // 上传文件
    Route::post('upload/:token', 'api/tieBa/upload');
    Route::get('test', 'api/tieBa/test?needToken=0');
    Route::post('test2', 'api/tieBa/test2?needToken=0');
})->ext('html');

// 收藏贴
Route::group('tieCollect', function () {
    // 收藏帖子列表
    Route::get('list/:token', 'index');
    // 点赞 或者 收藏
    Route::post('create/:token', 'create');
    // 取消点赞 或者 取消收藏
    Route::delete('delete/:token', 'delete');
})->prefix('api/tieBaCollect/')->ext('html');

// 我的
Route::group('mine', function () {
    // 我的页面
    Route::get('index/:token', 'mine/index');
    // 添加指纹
    Route::get('getFingerprint/:token', 'mine/getFingerprint');
    // 添加指纹
    Route::post('addFingerprint/:token', 'mine/addFingerprint');
    // 删除指纹
    Route::post('delFingerprint/:token', 'mine/delFingerprint');
    // 我的轨迹
    Route::get('watchLog/:token', 'oauthWatchLog/index');
    // 个性签名
    Route::post('signature/:token', 'mine/signature');
    // 自动播放
    Route::post('autoplay/:token', 'mine/autoplay');
    // 我的分享（佣金）
    Route::get('share/:token', 'oauthCommission/index');
})->prefix('api/')->ext('html');

// 我的关注
Route::group('focus', function () {
    Route::get('list/:token', 'index');
    Route::post('create/:token', 'create');
    Route::delete('delete/:token', 'delete');
})->prefix('api/oauthFocus/')->ext('html');

// 我的积分
Route::group('integral', function () {
    // 积分变化列表（签到列表）type > 0，则只获取type类型列表，传入0则获取全部积分列表
    Route::get('list/:token', 'index');
    // 签到
    Route::post('sign/:token', 'sign');
    // 通过班级id 观看视频、音频、背句子、背单词加积分
    Route::post('add/:token', 'addIntegral');
})->prefix('api/oauthIntegral/')->ext('html');

// 我的反馈
Route::group('feedback', function () {
    // 提交反馈
    Route::post('create/:token', 'create');
})->prefix('api/feedback/')->ext('html');

// 系统消息
Route::group('message', function () {
    // 系统消息列表
    Route::get('list/:token', 'index');
    // 详情
    Route::get('detail/:token', 'read');
})->prefix('api/message/')->ext('html');

// 常见问题
Route::group('question', function () {
    // 列表
    Route::get('list/:token', 'index');
    // 常见问题详情
    Route::get('detail/:token', 'read');
})->prefix('api/question/')->ext('html');



// 启动页--广告页
Route::group('switch', function () {
    // 搜索
    Route::post('advertisement', 'api/advertisement/index');
})->ext('html');


// 我的--个人信息资料
Route::group('userinfo', function () {
    // 个人信息资料
    Route::post('userinfo/:token', 'index');
    // 修改密码
    Route::post('updatepwd/:token', 'updatepwd');
    // 修改密码
    Route::post('addpwd/:token', 'addpwd');
    // 中英文切换
    Route::post('languageChange/:token', 'languageChange');
    // 绑定微信
    Route::post('isBindWechat/:token', 'isBindWechat');
    // 绑定微信
    Route::post('bindWechat/:token', 'bindWechat');
    // 解绑微信
    Route::post('untieWechat/:token', 'untieWechat');
    // 放弃原来的账号绑定新账号
    Route::post('repeatNewAccount/:token', 'repeatNewAccount');
    // 是否绑定设备
    Route::post('isBindDevice/:token', 'isBindDevice');
    // 绑定设备
    Route::post('bindDevice/:token', 'bindDevice');
    // 绑定手机
    Route::post('bindPhone/:token', 'bindPhone');
    // 游客是否购买课程
    Route::post('isBuyClass/:token', 'isBuyClass');
    // 是否绑定手机
    Route::post('isBindDeviceInfo/:token', 'isBindDeviceInfo');
    
})->prefix('api/userinfo/')->ext('html');


// 我的--离线中心
Route::group('cache', function () {
    // 增加个人缓存
    Route::post('addCache/:token', 'addCache');
    // 获取缓存列表
    Route::post('getCacheList/:token', 'getCacheList');
    // 获取某个班级的缓存数据
    Route::post('getOneCacheList/:token', 'getOneCacheList');
    // 删除总缓存
    Route::post('deleteCacheList/:token', 'deleteCacheList');
    // 删除单个缓存
    Route::post('deleteOneCacheList/:token', 'deleteOneCacheList');
    // 删除多个缓存
    Route::post('deleteMoreCacheList/:token', 'deleteMoreCacheList');
})->prefix('api/cache/')->ext('html');




// 下载单词包
Route::group('package', function () {
    // 下载单词包
    Route::post('word/:token', 'downloadWord');
    // 下载句子包
    Route::post('sentence/:token', 'downloadSentence');
})->prefix('api/package/')->ext('html');




Route::group('notify', function () {
    // 异步通知页面
    Route::post('transfer', 'transfer');
})->prefix('api/notify/')->ext('html');


// 国家区号列表
Route::group('prefix', function () {
    Route::get('list', 'api/CountryMobilePrefix/index');
})->ext('html');

return [

];
